#include "SymEntry.h"
#include "SymInfo.h"

#include <stdio.h>

SymEntry::SymEntry() :
		storageEntryStart(0), next(0), info(0) {
}

void SymEntry::Set(SymInfo* newInfo, char* lexem) {
	info = newInfo;
	storageEntryStart = lexem;
	next = 0;
}

SymEntry::~SymEntry() {
}

bool SymEntry::matchesLexem(char* testLexem) {
	int checkedWordsLength = testLexem[0];

	char* storageStart = &storageEntryStart[1];

	char* testWord = &testLexem[1];

	// compare if strings are equal
	return (memcmp(storageStart, testWord,
			checkedWordsLength * sizeof(char)) == 0);
}

void SymEntry::append(SymEntry* newEntry) {
	next = newEntry;
}
